package com.artieksi.action;

import com.artieksi.entity.SignBean;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

public class MainPageAction extends BaseAction {

    private String todayStr;
    private String thisWeeksStr;
    private String thisMonthsStr;
    private List<SignBean> todaysPlusSigns;
    private List<SignBean> todaysMinusSigns;
    private List<SignBean> thisWeeksPlusSigns;
    private List<SignBean> thisWeeksMinusSigns;
    private List<SignBean> thisMonthsPlusSigns;
    private List<SignBean> thisMonthsMinusSigns;

    public String execute(){
        todayStr = sdf.format(new Date());
        thisWeeksStr = sdf.format(new Date().getTime() - (60 * 1000 * 60 * 24 * 7L)) + " - " + sdf.format(new Date());
        thisMonthsStr = sdf.format(new Date().getTime() - (60 * 1000 * 60 * 24 * 30L)) + " - " + sdf.format(new Date());
        todaysPlusSigns = artiEksiDAO.getTodaysSigns("+");
        todaysMinusSigns = artiEksiDAO.getTodaysSigns("-");
        thisWeeksPlusSigns = artiEksiDAO.getThisWeeksSigns("+");
        thisWeeksMinusSigns = artiEksiDAO.getThisWeeksSigns("-");
        thisMonthsPlusSigns = artiEksiDAO.getThisMonthsSigns("+");
        thisMonthsMinusSigns = artiEksiDAO.getThisMonthsSigns("-");
        return SUCCESS;
    }

    public List<SignBean> getTodaysPlusSigns() {
        return todaysPlusSigns;
    }

    public void setTodaysPlusSigns(List<SignBean> todaysPlusSigns) {
        this.todaysPlusSigns = todaysPlusSigns;
    }

    public List<SignBean> getTodaysMinusSigns() {
        return todaysMinusSigns;
    }

    public void setTodaysMinusSigns(List<SignBean> todaysMinusSigns) {
        this.todaysMinusSigns = todaysMinusSigns;
    }

    public String getTodayStr() {
        return todayStr;
    }

    public void setTodayStr(String todayStr) {
        this.todayStr = todayStr;
    }

    public List<SignBean> getThisWeeksPlusSigns() {
        return thisWeeksPlusSigns;
    }

    public void setThisWeeksPlusSigns(List<SignBean> thisWeeksPlusSigns) {
        this.thisWeeksPlusSigns = thisWeeksPlusSigns;
    }

    public List<SignBean> getThisWeeksMinusSigns() {
        return thisWeeksMinusSigns;
    }

    public void setThisWeeksMinusSigns(List<SignBean> thisWeeksMinusSigns) {
        this.thisWeeksMinusSigns = thisWeeksMinusSigns;
    }

    public List<SignBean> getThisMonthsPlusSigns() {
        return thisMonthsPlusSigns;
    }

    public void setThisMonthsPlusSigns(List<SignBean> thisMonthsPlusSigns) {
        this.thisMonthsPlusSigns = thisMonthsPlusSigns;
    }

    public List<SignBean> getThisMonthsMinusSigns() {
        return thisMonthsMinusSigns;
    }

    public void setThisMonthsMinusSigns(List<SignBean> thisMonthsMinusSigns) {
        this.thisMonthsMinusSigns = thisMonthsMinusSigns;
    }

    public String getThisWeeksStr() {
        return thisWeeksStr;
    }

    public void setThisWeeksStr(String thisWeeksStr) {
        this.thisWeeksStr = thisWeeksStr;
    }

    public String getThisMonthsStr() {
        return thisMonthsStr;
    }

    public void setThisMonthsStr(String thisMonthsStr) {
        this.thisMonthsStr = thisMonthsStr;
    }
}